package com.lw.config;

import com.lw.pojo.User;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

/**
 * @author LW
 * @2020/10/1 14:28
 */
@Configuration
//@ComponentScan("com.lw.pojo")
@Import(MyConfig2.class)
public class MyConfig {

    /**
     * 注册一个bean，相当于写一个bean标签，id是方法名
     * class是返回值
     * @return
     */
    @Bean//注册了bean就不需要在类上@Component加入容器了
    public User getUser(){
        return new User();//就是返回要准入到bean的对象！
    }

}
